import request  from '@/utils/request'

//获取员工的数据
export function getEmployeeList(params){
    return request({
        url:'/sys/user',
        method:'get',
        params
    })
}
//excle表格导出
export function importExcle(){
    return request({
        url:'/sys/user/export',
        responseType: 'blob' // 使用blob接收二进制文件流
    })
}
//excle模版下载
export function getExportTemplate(){
    return request({
        url:'/sys/user/import/template',
        responseType: 'blob'
    })
}
//excle数据导入
export function exportUpload(data){
    return request({
        url:'/sys/user/import',
        method:'post',
        data
    })
}
//删除员工
export function deleteEmployee(id){
    return request({
        url:`/sys/user/${id}`,
        method:'delete'
    })
}
//添加员工
export function addEmployee(data){
    return request({
        url:'/sys/user',
        method:'post',
        data 
    })
}
//获取员工详情
export function getEmployeeById(id){
    return request({
        url: `/sys/user/${id}`
    })
}
//更新员工
export function updateEmployee(data){
    return request({
        url:`/sys/user/${data.id}`,
        method:'put',
        data
    })
}
//已启用的角色列表
export function getEnableRoleList(){
    return request({
        url:'/sys/role/list/enabled',
        method:'get'
    })
}
//编辑角色
export function assignRole(data){
    return request({
        url:'/sys/user/assignRoles',
        method: 'put',
        data
    })
}